package com.songcha.sakura.util

import android.app.AlertDialog
import android.content.Context

class DialogUtil {
    companion object{
        fun showalertDialog(context: Context,
                            title:String="",
                            msg:String="",
                            confirmText:String="确定",
                            cancelText:String="取消",
                            onConfirmPress:()->Unit,
                            onCancelPress:()->Unit = {}
        ){
            val alertDialog =  AlertDialog.Builder(context).
            setTitle(title).
            setMessage(msg).
            //setIcon(R.drawable.ic_launcher).
            setPositiveButton(confirmText){d,id->
                onConfirmPress()
            }.
            setNegativeButton(cancelText){d,id->
                onCancelPress()
            }.
            create()

            alertDialog.show()
        }
    }

}